E-Tech Timer / E-Tech Timer / settings.vbon commit add archived files (d846247)
   1Public Class settings
   2
   3    Private Sub KryptonButton2_Click(sender As Object, e As EventArgs) Handles KryptonButton2.Click
   4        'Close the settings dialog without saving the settings
   5        Me.Close()
   6    End Sub
   7
   8    Private Sub settings_Load(sender As Object, e As EventArgs) Handles MyBase.Load
   9        'Loads the settings from My.Settings
  10        If My.Settings.hideExtra = False Then
  11            KryptonCheckBox1.Checked = False
  12        End If
  13        KryptonComboBox1.Text = My.Settings.alertName
  14        If My.Settings.keepCounting = True Then
  15            KryptonCheckBox2.Checked = True
  16        End If
  17        If My.Settings.autoTime = True Then
  18            KryptonCheckBox4.Checked = True
  19        End If
  20        If My.Settings.showLogDefault = True Then
  21            KryptonCheckBox3.Checked = True
  22        End If
  23        If My.Settings.startupMode = "c" Then
  24            KryptonComboBox2.Text = "Countdown"
  25        End If
  26        If My.Settings.startupMode = "s" Then
  27            KryptonComboBox2.Text = "Stopwatch"
  28        End If
  29    End Sub
  30
  31    Private Sub KryptonButton1_Click(sender As Object, e As EventArgs) Handles KryptonButton1.Click
  32        'Saves the settings then closes the settings dialog
  33
  34
  35        '1/10th Second Resolution
  36        If KryptonCheckBox1.Checked Then
  37            My.Settings.hideExtra = True
  38            If stopwatch.Label1.Text = "00:00:00.00000" Or stopwatch.Timer1.Enabled = False Then
  39                stopwatch.Label1.Text = "00:00:00.00"
  40                stopwatch.Label1.Left = (198.5) - (stopwatch.Label1.Width / 2) 'Center label in form
  41            End If
  42            If countdown.Label1.Text = "00:00:00.00000" Or countdown.Timer1.Enabled = False Then
  43                countdown.Label1.Text = "00:00:00.00"
  44                countdown.Label1.Left = (198.5) - (countdown.Label1.Width / 2) 'Center label in form
  45            End If
  46        Else
  47            My.Settings.hideExtra = False
  48            If stopwatch.Label1.Text = "00:00:00.00" Or stopwatch.Timer1.Enabled = False Then
  49                stopwatch.Label1.Text = "00:00:00.00000"
  50                stopwatch.Label1.Left = (198.5) - (stopwatch.Label1.Width / 2) 'Center label in form
  51            End If
  52            If countdown.Label1.Text = "00:00:00.00" Or countdown.Timer1.Enabled = False Then
  53                countdown.Label1.Text = "00:00:00.00000"
  54                countdown.Label1.Left = (198.5) - (countdown.Label1.Width / 2) 'Center label in form
  55            End If
  56        End If
  57
  58        'Alert
  59        If Not My.Settings.alertName = KryptonComboBox1.Text Then
  60            My.Settings.alertName = KryptonComboBox1.Text
  61        End If
  62
  63        'Keep Counting after Alert
  64        If KryptonCheckBox2.Checked Then
  65            My.Settings.keepCounting = True
  66        Else
  67            My.Settings.keepCounting = False
  68        End If
  69
  70        'Automatically start timing
  71        If KryptonCheckBox4.Checked Then
  72            My.Settings.autoTime = True
  73        Else
  74            My.Settings.autoTime = False
  75        End If
  76
  77        'Automatically show log
  78        If KryptonCheckBox3.Checked Then
  79            My.Settings.showLogDefault = True
  80        Else
  81            My.Settings.showLogDefault = False
  82        End If
  83
  84        'Startup mode
  85        If KryptonComboBox2.Text = "Stopwatch" Then
  86            My.Settings.startupMode = "s"
  87        End If
  88        If KryptonComboBox2.Text = "Countdown" Then
  89            My.Settings.startupMode = "c"
  90        End If
  91
  92
  93        My.Settings.Save()
  94        Me.Close()
  95    End Sub
  96
  97    Private Sub KryptonButton3_Click(sender As Object, e As EventArgs) Handles KryptonButton3.Click
  98        'Tests the selected sound
  99        Dim Sound As New System.Media.SoundPlayer()
 100        If KryptonComboBox1.Text = "Horn" Then
 101            Sound.Stream = My.Resources.horn
 102        ElseIf KryptonComboBox1.Text = "Morning" Then
 103            Sound.Stream = My.Resources.morning
 104        ElseIf KryptonComboBox1.Text = "Tinkle" Then
 105            Sound.Stream = My.Resources.tinkle
 106        End If
 107        Sound.Load()
 108        Sound.Play()
 109    End Sub
 110
 111    Private Sub KryptonButton4_Click(sender As Object, e As EventArgs) Handles KryptonButton4.Click
 112        'Set the Log ID to 0
 113        My.Settings.logID = 0
 114        My.Settings.countdownLogID = 0
 115    End Sub
 116
 117    Private Sub KryptonButton5_Click(sender As Object, e As EventArgs) Handles KryptonButton5.Click
 118        Process.Start("https://etechtimer.codeplex.com/wikipage?title=Acceptable%20Input%20Formats")
 119    End Sub
 120End Class